package cc.mcyx.ychat.controller

import cc.mcyx.ychat.mihoyo.MihoyoService
import cc.mcyx.ychat.service.UserService
import cc.mcyx.ychat.service.impl.AuthService
import cc.mcyx.ychat.vo.request.LoginRequestVo
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("api/auth")
@ResponseBody
@Api("身份验证", tags = ["身份验证"])
open class AuthController {

    @Autowired
    lateinit var userService: UserService

    @Autowired
    lateinit var mihoyoService: MihoyoService

    @Autowired
    lateinit var authService: AuthService

    @PostMapping("login")
    @ApiOperation("登录")
    fun login(@RequestBody loginVo: LoginRequestVo): String {
        return authService.login(loginVo).token
    }
}